package cn.tedu.batch.transformation

import org.apache.flink.api.scala.{DataSet, ExecutionEnvironment}

/**
 * @author Amos
 * @date 2022/5/19
 */

object BatchMapDemo {
  def main(args: Array[String]): Unit = {
    val env = ExecutionEnvironment.getExecutionEnvironment
    import org.apache.flink.api.scala._
    val source: DataSet[String] = env.fromElements("1,张三", "2,李四", "3,王五", "4,赵六")
    // map 算子
    val result:DataSet[User] = source.map(ele => User(ele.split(",")(0).toInt, ele.split(",")(1)))
    result.print()


  }

}

case class User(id:Integer, name: String)
